<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <form action="" method="post">
        请输入开始截取的位置: <input type="text" name="start"><br>
        请输入截取结束的未知: <input type="text" name="stop"><input type="submit" name="sub" value="截取">
    </form>
</body>
</html>
<?php
/**
 * User: lie
 * Date: 2020-11-10 0:19
 * description: 自定义截取函数
 */
header("Content-type: text/html; charset=utf-8");
if ($_POST['sub']){
    function str1(){
        $a = "自定义函数截取中文字符串被截取的部分";
        $rs = substr($a, (2*$_POST['start']-2), (2*$_POST['stop']));
        echo $rs;
    }
}
str1();
?>